<?php
class Api_Getorder_Controller extends Base_Controller {
    
//获取订单数据的接口
public function action_get()
{
    //$url = "http://wlchannel.cc/api/text/putinfo";        //定义要获取api的接口url
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_HEADER, 0);                  //设置头文件的信息作为数据流输出
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);          //设置获取的信息以文件流的形式返回，而不是直接输出。
    $result = curl_exec($ch);
    $orders = json_decode($result,true);
    $username = isset($orders['username']) ? $orders['username'] : '';   //车主
    $order_number = isset($orders['order_number']) ? $orders['order_number'] : '';   //订单号
    $shopname = isset($orders['shopname']) ? $orders['shopname'] : '';   //店名
    $f_id = isset($orders['f_id']) ? $orders['f_id'] : '';               //服务内容
    $phone = isset($orders['phone']) ? $orders['phone'] : '';            //联系方式
    $firm_orders = isset($orders['firm_orders']) ? $orders['firm_orders'] : '';  //核验码
    $status = isset($orders['status']) ? $orders['status'] : '';                // 订单状态
    $platenumber = isset($orders['platenumber']) ? $orders['platenumber'] : '';  // 车牌号
    $timeapp = isset($orders['timeapp']) ? $orders['timeapp'] : '';    //预约时间
    $str = DB::table('orders')->insert(array('username'=>$username,'shopname'=>$shopname,'f_id'=>$f_id,'phone'=>$phone,'firm_orders'=>$firm_orders,'status'=>$status,'platenumber'=>$platenumber,'timeapp'=>$timeapp));
}



}

